const express = require("express")
const router = express.Router()
const {searchProd,
    searchAdvice,
    searchComment} = require("../control/trace")
const {SuccessModel,ErrorModel} = require("../model/resModel")

router.post("/trace", (req,res)=>{
    let promiseArr = [searchProd(req,res),searchAdvice(req,res),searchComment(req,res)]
    Promise.all(promiseArr).then(data=>{
        if(data.length>0){
            res.json(new SuccessModel(data,"查找成功"))
        }else{
            res.json(new ErrorModel("查找失败"))

        }
    })
})

module.exports=router
